#ifndef COMMON_EXCEPTION_H
#define COMMON_EXCEPTION_H

#include <string>
#include <stdexcept>

class BadException : public std::exception
{
public:
    BadException() { message = std::string("Bad Exception."); }
    explicit BadException(const std::string_view& str) { message = std::string("Bad Exception : ") + str.data(); }
    ~BadException() override = default;
    [[nodiscard]] const char* what() const noexcept override { return message.c_str(); }
private:
    std::string message;
};

class OutOfRangeException : public std::exception
{
public:
    OutOfRangeException() { message = std::string("Out Of Range Exception."); }
    explicit OutOfRangeException(const std::string_view& str) { message = std::string("Out Of Range Exception : ") + str.data(); }
    ~OutOfRangeException() override = default;
    [[nodiscard]] const char* what() const noexcept override { return message.c_str(); }
private:
    std::string message;
};

class ArrayIndexOutOfBoundsException : public std::exception
{
public:
    ArrayIndexOutOfBoundsException() { message = std::string("Array Index Out Of Bounds Exception."); }
    explicit ArrayIndexOutOfBoundsException(const std::string_view& str) { message = std::string("Array Index Out Of Bounds Exception : ") + str.data(); }
    ~ArrayIndexOutOfBoundsException() override = default;
    [[nodiscard]] const char* what() const noexcept override { return message.c_str(); }
private:
    std::string message;
};


#endif //COMMON_EXCEPTION_H
